package com.xteam.utils;

import java.sql.Timestamp;
import java.util.Date;

final public class ConvertTools {

	ConvertTools() {
	}

	public static Object convert(Class<?> clazz, String value) {
		if (clazz == int.class || clazz == Integer.class)
			return Integer.valueOf(value);
		else if (clazz == Date.class)
			return java.sql.Date.valueOf(value);
		else if (clazz  == Timestamp.class)
			return Timestamp.valueOf(value);
		else if (clazz == short.class || clazz == Short.class) 
			return Short.valueOf(value);
		else if (clazz == String.class)
			return value;
		else
			throw new ClassCastException("类型转换失败！");
	}

}
